/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #333;
    overflow-x: hidden;
    /* Increased base font size for better readability */
    font-size: 16px;
}

/* Container with responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-height: 450px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Responsive height for full browser */
@media (min-height: 500px) and (min-width: 800px) {
    .container {
        height: 90vh;
        max-height: 90vh;
    }
}

/* Header tooltip for space saving */
.header-tooltip {
    position: relative;
    display: inline-block;
    background: #2196f3;
    color: white;
    width: 28px; /* Increased from 24px */
    height: 28px; /* Increased from 24px */
    border-radius: 50%;
    text-align: center;
    line-height: 28px; /* Adjusted for new size */
    cursor: pointer;
    font-size: 14px; /* Increased from 12px */
    align-self: flex-end;
    margin-bottom: 4px;
}

.header-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text {
    visibility: hidden;
    width: 320px; /* Increased from 280px */
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px; /* Increased from 8px */
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    right: 0;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 13px; /* Increased from 11px */
    line-height: 1.4; /* Increased from 1.3 */
}

/* Story section */
.story-section {
    flex: 0 0 auto;
    margin-bottom: 8px;
}

.scene-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.scene-card {
    background: white;
    border-radius: 8px;
    padding: 10px; /* Increased from 8px */
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 90px; /* Increased from 80px */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.scene-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background: #f8f9fa;
}

.scene-card.active {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.scene-image {
    font-size: 28px; /* Increased from 24px */
    margin-bottom: 6px; /* Increased from 4px */
}

.scene-title {
    font-size: 13px; /* Increased from 11px */
    font-weight: bold;
    margin-bottom: 3px; /* Increased from 2px */
    color: #333;
}

.scene-description {
    font-size: 11px; /* Increased from 9px */
    color: #666;
    line-height: 1.3; /* Increased from 1.2 */
}

/* Discussion panel */
.discussion-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 12px; /* Increased from 10px */
    display: flex;
    flex-direction: column;
    gap: 10px; /* Increased from 8px */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.discussion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px; /* Increased from 6px */
}

.discussion-header h3 {
    font-size: 16px; /* Increased from 14px */
    color: #333;
}

.partner-mode {
    font-size: 13px; /* Increased from 11px */
}

.partner-mode input {
    margin-right: 6px; /* Increased from 4px */
}

/* Question section */
.question-section {
    background: #f8f9fa;
    padding: 10px; /* Increased from 8px */
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.question-prompt {
    font-size: 14px; /* Increased from 12px */
    color: #333;
    line-height: 1.5; /* Increased from 1.4 */
}

/* Language scaffolds */
.language-scaffolds {
    flex: 0 0 auto;
}

.scaffold-title {
    font-size: 13px; /* Increased from 11px */
    font-weight: bold;
    margin-bottom: 6px; /* Increased from 4px */
    color: #666;
}

.scaffold-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px; /* Increased from 4px */
}

.scaffold-btn {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 6px;
    padding: 8px 10px; /* Increased from 6px 8px */
    font-size: 12px; /* Increased from 10px */
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1976d2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scaffold-btn:hover {
    background: #2196f3;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.scaffold-btn:active {
    transform: translateY(0);
}

/* Response area */
.response-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Increased from 6px */
}

.response-display {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px; /* Increased from 8px */
    min-height: 70px; /* Increased from 60px */
    font-size: 13px; /* Increased from 11px */
    line-height: 1.5; /* Increased from 1.4 */
    overflow-y: auto;
}

.response-placeholder {
    color: #999;
    font-style: italic;
}

.response-item {
    background: white;
    padding: 6px 8px; /* Increased from 4px 6px */
    margin: 3px 0; /* Increased from 2px 0 */
    border-radius: 4px;
    border-left: 3px solid #2196f3;
    font-size: 12px; /* Increased from 10px */
}

.response-controls {
    display: flex;
    gap: 8px; /* Increased from 6px */
}

.control-btn {
    flex: 1;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px; /* Increased from 6px */
    font-size: 12px; /* Increased from 10px */
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.control-btn#shareBtn {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.control-btn#shareBtn:hover {
    background: #45a049;
}

/* Activity footer */
.activity-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 8px 12px; /* Increased from 6px 10px */
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.timer {
    display: flex;
    align-items: center;
    gap: 8px; /* Increased from 6px */
}

.timer-btn {
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px; /* Increased from 4px 8px */
    font-size: 11px; /* Increased from 9px */
    cursor: pointer;
    transition: background 0.2s ease;
}

.timer-btn:hover {
    background: #f57c00;
}

#timerDisplay {
    font-size: 14px; /* Increased from 12px */
    font-weight: bold;
    color: #333;
    min-width: 45px; /* Increased from 40px */
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: 8px; /* Increased from 6px */
}

.progress-bar {
    width: 90px; /* Increased from 80px */
    height: 8px; /* Increased from 6px */
    background: #e0e0e0;
    border-radius: 4px; /* Increased from 3px */
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 11px; /* Increased from 9px */
    color: #666;
}

/* Center tooltip for detailed information */
.center-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 90%;
    max-height: 80%;
    z-index: 2000;
    display: none;
    overflow: hidden;
}

.center-tooltip.show {
    display: block;
}

.tooltip-content {
    padding: 20px; /* Increased from 16px */
    font-size: 14px; /* Increased from 12px */
    line-height: 1.6; /* Increased from 1.5 */
    max-height: 350px; /* Increased from 300px */
    overflow-y: auto;
}

.tooltip-close {
    position: absolute;
    top: 10px; /* Increased from 8px */
    right: 10px; /* Increased from 8px */
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px; /* Increased from 24px */
    height: 28px; /* Increased from 24px */
    cursor: pointer;
    font-size: 16px; /* Increased from 14px */
    line-height: 1;
}

/* Mobile optimizations */
@media (max-width: 600px) {
    .scene-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px; /* Increased from 4px */
    }
    
    .scene-card {
        min-height: 80px; /* Increased from 70px */
        padding: 8px; /* Increased from 6px */
    }
    
    .scene-image {
        font-size: 24px; /* Increased from 20px */
    }
    
    .scaffold-buttons {
        grid-template-columns: 1fr;
    }
    
    .scaffold-btn {
        font-size: 13px; /* Increased from 11px */
        padding: 10px; /* Increased from 8px */
        white-space: normal;
    }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    .scene-card,
    .scaffold-btn,
    .control-btn,
    .timer-btn {
        min-height: 48px; /* Increased from 44px */
        touch-action: manipulation;
    }
    
    .scaffold-btn {
        padding: 10px; /* Increased from 8px */
    }
}